<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>十进制转二进制</title>
</head>

<body>
    <script>
        /* 

        */
        function ten2two(ten_num) {
            let stack = [];

            while (ten_num > 0) {
                stack.push(ten_num % 2);
                ten_num = Math.floor(ten_num / 2);
            }
            let binaryString = '';
            while (stack.length > 0) {
                binaryString += stack.pop();
            }
            return binaryString;
        }
        let res = ten2two(100);
        console.log(res);
    </script>
</body>

</html>